﻿@model Resto.CostControl.Core.DishMaterial
@{
    ViewBag.Title = "品名选择";
    Layout = "~/Views/Shared/_LayoutForm.cshtml"; 
}
@using (Html.AjaxBeginForm("SaveItem"))
{ 
    <div class="pageFormContent">
        @Html.HiddenFor(model => model.Id)
        @Html.HiddenFor(model => model.MaterialId)
        @Html.HiddenFor(model => model.DishId)
        @Html.DWZTextBoxFor(model => model.Name, @Url.GridLink("setGroup", "选择", "SelectMaterial()", new { style = "display: block; float: left; padding-top:5px;" }), new { style = "width:100px" }).ReadOnly(true)
        @Html.DWZTextBoxFor(model => model.Code).Required().ReadOnly(true)
        @Html.DWZTextBoxFor(model => model.CurrentPrice).Number()
        @Html.DWZDropDownListFor(model => model.Type, "MaterialType").ReadOnly(true)
        @Html.DWZTextBoxFor(model => model.Weight).Number().Required()
    </div>
}
@Html.FormBar()
<script type="text/javascript">
    function SelectMaterial(e) {
        OpenModalDialog('@Url.Action("LookUp")', { width: 840, height: 400, onclose: function (MaterialData) {
            if (MaterialData) {
                $("#MaterialId").val(MaterialData[0]);
                $("#Code").val(MaterialData[1]);
                $("#Name").val(MaterialData[2]);
                $("#CurrentPrice").val(MaterialData[3]);
                $("#Type").val(MaterialData[4]);
            }
        }
        });
    }
</script>